package cc.io24.knewcafe.boss.facade;

import org.springframework.hateoas.PagedResources;
import org.springframework.web.bind.annotation.*;

public interface BasicFacade<T> {

    @RequestMapping(value = "/", method = RequestMethod.GET)
    PagedResources<T> findAll(@RequestParam("page") String page, @RequestParam("size") String size, @RequestParam("sort") String sort);

    @RequestMapping(method = RequestMethod.GET, value = "/{id}")
    T findById(@PathVariable("id") String id);

    @RequestMapping(method = RequestMethod.DELETE, value = "/{id}")
    String deleteById(@PathVariable("id") String id);

    @RequestMapping(method = RequestMethod.PUT, value = "/{id}", consumes = {"application/json"}, produces = {"application/json"})
    T save(@RequestBody T t, @PathVariable("id") String id);

    @RequestMapping(method = RequestMethod.POST, value = "/", consumes = {"application/json"}, produces = {"application/json"})
    T insert(@RequestBody T t);


}
